package middleware

import (
	"net/http"
	"strings"

	"github.com/gin-gonic/gin"
)

func RecordRequestLog() gin.HandlerFunc {
	fn := func(ctx *gin.Context) {
		url := strings.Trim(ctx.Request.URL.Path, "/")
		if len(url) == 0 {
			ctx.JSON(http.StatusInternalServerError, gin.H{"code": 1, "msg": "路由错误", "data": "[]"})
			ctx.Abort()
		}

		// TODO: 记录管理员操作日志
	}
	return fn
}
